package roleEditor.view
{
	import asset.roleEditor.baseViewAsset;
	
	import flash.events.MouseEvent;
	
	import roleEditor.common.ScreenMessage;
	import helper.StringHelper;
	import roleEditor.model.RoleModel;

	public class RoleBaseInfoView extends baseViewAsset
	{
		private var _model:RoleModel;
		
		public function RoleBaseInfoView(model:RoleModel)
		{
			_model=model;
			setView();
			setEvent();
		}
		
		private function setView():void
		{
			txtRoleName.text=_model.roleName ? _model.roleName : "";
			txtConfigPath.text=_model.configPath ? _model.configPath : "";
		}
		
		private function setEvent():void
		{
		}
		
		public function saveBaseInfo():void
		{
			if(StringHelper.IsNullOrEmpty(txtRoleName.text))
			{
				ScreenMessage.Instance.msg="角色名称未填写!";
				return;
			}

			if(StringHelper.IsNullOrEmpty(txtConfigPath.text))
			{
				ScreenMessage.Instance.msg="配置文件未填写!";
				return;
			}
			
			_model.roleName=txtRoleName.text;
			_model.configPath=txtConfigPath.text;
		}
		
		public function dispose():void
		{
		}
	}
}